#include "base_call_agent.hpp"

namespace p2pms
{

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
BaseCallAgent::BaseCallAgent(CallMode mode, CallRole role, const std::string& user_id)
	: m_call_mode(mode), m_call_role(role)
{
	assert(mode != CallMode::CALL_MODE_INVALID);
	assert(role != CallRole::Undefined);
	assert(!user_id.empty());

	if (role == CallRole::Caller) {
		m_caller_id = user_id; // Caller sets their own ID
	} else {
		m_callee_id = user_id; // Callee sets their own ID
	}
}

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
CallMode BaseCallAgent::GetCallMode()
{
	return m_call_mode;
}

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
CallState BaseCallAgent::GetCallState()
{
	return m_call_state;
}

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
std::string BaseCallAgent::GetCallerId()
{
	return m_caller_id;
}

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
std::string BaseCallAgent::GetCalleeId()
{
	return m_callee_id;
}

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
std::string BaseCallAgent::GetCallId()
{
	return m_call_id;
}

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
std::string BaseCallAgent::GetPeerUserId()
{
	return (m_call_role == CallRole::Caller ? m_callee_id : m_caller_id);
}

//--------------------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------
std::string BaseCallAgent::GetUserId()
{
	return (m_call_role == CallRole::Caller ? m_caller_id : m_callee_id);
}

}